package com.ruoyi.youtian.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.youtian.domain.FaultRecordDetail;
import com.ruoyi.youtian.mapper.FaultRecordDetailMapper;
import com.ruoyi.youtian.service.IFaultRecordDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 故障记录Service业务层处理
 *
 * @author ruoyi
 * @date 2022-09-08
 */
@Service
public class FaultRecordDetailServiceImpl implements IFaultRecordDetailService
{
    @Autowired
    private FaultRecordDetailMapper faultRecordDetailMapper;

    /**
     * 查询故障记录
     *
     * @param faultRecordDetailId 故障记录主键
     * @return 故障记录
     */
    @Override
    public FaultRecordDetail selectFaultRecordDetailByFaultRecordDetailId(Long faultRecordDetailId)
    {
        return faultRecordDetailMapper.selectFaultRecordDetailByFaultRecordDetailId(faultRecordDetailId);
    }

    /**
     * 查询故障记录列表
     *
     * @param faultRecordDetail 故障记录
     * @return 故障记录
     */
    @Override
    public List<FaultRecordDetail> selectFaultRecordDetailList(FaultRecordDetail faultRecordDetail)
    {
        return faultRecordDetailMapper.selectFaultRecordDetailList(faultRecordDetail);
    }

    /**
     * 新增故障记录
     *
     * @param faultRecordDetail 故障记录
     * @return 结果
     */
    @Override
    public int insertFaultRecordDetail(FaultRecordDetail faultRecordDetail)
    {
        faultRecordDetail.setCreateTime(DateUtils.getNowDate());
        return faultRecordDetailMapper.insertFaultRecordDetail(faultRecordDetail);
    }

    /**
     * 修改故障记录
     *
     * @param faultRecordDetail 故障记录
     * @return 结果
     */
    @Override
    public int updateFaultRecordDetail(FaultRecordDetail faultRecordDetail)
    {
        faultRecordDetail.setUpdateTime(DateUtils.getNowDate());
        return faultRecordDetailMapper.updateFaultRecordDetail(faultRecordDetail);
    }

    /**
     * 批量删除故障记录
     *
     * @param faultRecordDetailIds 需要删除的故障记录主键
     * @return 结果
     */
    @Override
    public int deleteFaultRecordDetailByFaultRecordDetailIds(Long[] faultRecordDetailIds)
    {
        return faultRecordDetailMapper.deleteFaultRecordDetailByFaultRecordDetailIds(faultRecordDetailIds);
    }

    /**
     * 删除故障记录信息
     *
     * @param faultRecordDetailId 故障记录主键
     * @return 结果
     */
    @Override
    public int deleteFaultRecordDetailByFaultRecordDetailId(Long faultRecordDetailId)
    {
        return faultRecordDetailMapper.deleteFaultRecordDetailByFaultRecordDetailId(faultRecordDetailId);
    }
}
